SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE dbo.[DnnProduct_AddSearchWord]
	@Word nvarchar(100)
 
AS

DECLARE @id int
SELECT @id = SearchWordsID 
	FROM dbo.DnnProduct_SearchWord
	WHERE Word = @Word
 

IF @id IS NULL
	BEGIN
		INSERT INTO dbo.DnnProduct_SearchWord (
			[Word],
			[IsCommon],
			[HitCount]
			) 
		VALUES (
			@Word,
			0,
			1
		)

		SELECT SCOPE_IDENTITY()
	END
ELSE
	SELECT @id


GO
